home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
yerk
/
mps231ss.hqx
/
Mops source
/
Nuc source
/
OD.asm
< prev
next >
Wrap
Assembly Source File
|
1992-10-08
|
5KB
|
191 lines
; Operation descriptor definition. An OD keeps track of optimization
; possibilities. We usually address ODs via A0, so we make this the default.
base A0
dsec 0
opType byte ; main type
opSubType byte ; subtype
opSize equ *-1 ; for fetches/stores, size code
opToFrom byte ; for fetches/stores, source or dest reg
opMode byte ; Address mode - see definition below
opBreg byte ; base reg (normally A3)
opReg equ *-1 ; reg for reg direct mode
; (really same as base reg)
opXreg byte ; Index register
opShort equ *-1 ; Flags a short literal or short imm address
opRoffs equ *-1 ; FPU constant ROM offset
opShiftCnt equ *-1 ; Shift count (for shifts, of course)
opFlags byte ; Sundry other flags
opInd byte ; Indirection count (0 = immediate, etc.)
opLit long ; literal value (if appropriate)
opDispl equ *-4 ; displacement
opFPDP equ *-4 ; saves DP in floating op before store back
opAddr long ; saves the data address (if a mem reference)
opDP long ; Saves DP value - this must come last
dend ODsize
endb
; opMode values:
mdBD equ 0 ; An-displacement
mdX equ 1 ; Indexed
mdAbs equ 2 ; absolute
mdLit equ 3 ; literal
mdDn equ 4 ; Dn direct
mdAn equ 5 ; An direct
mdPC equ 6 ; PC-relative
mdPCX equ 7 ; PC-relative with index
mdFPn equ 8 ; FPn
; Codes for opMode or opToFrom. Note the stack codes are all negative.
stkPush equ $FF ; With stack push
stk equ $FE ; To/from stack without push or pop
stkPop equ $FD ; With stack pop
fromMem equ $E0 ; In a store descriptor, marks a chained op
; with a preceding fetch.
fchChn equ $70 ; In an arithmetic descriptor, marks a chained
; op with a preceding fetch.
; opReg flags:
AnReg equ $40
FPnReg equ $20
noReg equ $48
; Flag byte bits:
flExt equ 0 ; Sign extend
fbExt equ $01
flFP equ 1 ; Floating operation
fbFP equ $02
flLit equ 2 ; Floating Literal
fbLit equ $04
flFCR equ 3 ; FPU constant ROM reference
fbFCR equ $08
; Codes for ODs:
; Type byte
; otMove equ $10
otMulDiv equ $12
otMUL equ $12
otDIV equ $13
otPMops equ $21 ; Codes for integer arith/logical ops.
otADD equ $21
otSUB equ $22
otAND equ $23
otOR equ $24
otEOR equ $25
otCMP equ $26
otMon equ $28 ; The following ops are monadic
otNEG equ $28
otNOT equ $29
otSHIFT equ $2A ; shift by a constant
otRevSub equ $2E ; Reverse subtract
otPMend equ $30 ; End of integer ops
otFPcmp equ $3F ; Floating-point comparison. A special case.
otFPops equ $40 ; Start of regular floating-point ops. Note
; these are NOT in the same order as the
; integer ops.
otFMOVE equ $40
otFADD equ $41
otFMUL equ $42
otFPnoncom equ $48 ; The following FP ops are non-commutative
otFSUB equ $48
otFDIV equ $49
otFPmon equ $54 ; The following FP ops are monadic
otFABS equ $54
otFNEG equ $55
otFSIN equ $56
otFCOS equ $57
otFTAN equ $58
otFATAN equ $59
otFSQRT equ $5A
otFPend equ $60 ; End of FP ops
otStore equ $60 ; Store
otFetch equ $61 ; Direct fetch
otAt equ otFetch ; Indirect fetch - ends up being treated
; the same
otDUP equ $62 ; DUP etc.
otOVER equ $63 ; OVER
otSWAP equ $64 ; SWAP
otCCok equ $70 ; Used to mark CC as valid for top-of-stack
; operand if nothing else. All codes for
; which otStore < code <= otCCok,
; indicate that the CC is valid.
otJSR equ $71 ; Plain vanilla JSR
otBit equ $72 ; Bit operations
otOp2M equ $73 ; Operation to memory - ++> etc.
; Comparisons (type and subtype together - type is always otCMP)
; The subtype codes are based on the corresponding 68000 codes, which are
; very logical. For example, the inverse condition is obtained by
; inverting the low bit.
tsEQ equ otCMP*256 + $7
tsNE equ otCMP*256 + $6
tsGE equ otCMP*256 + $C
tsLT equ otCMP*256 + $D
tsLE equ otCMP*256 + $F
tsGT equ otCMP*256 + $E
tsLO equ otCMP*256 + $5
tsLS equ otCMP*256 + $3
tsHI equ otCMP*256 + $2
tsHS equ otCMP*256 + $4
tsZEQ equ otCMP*256 + $17
tsZNE equ otCMP*256 + $16
tsZGE equ otCMP*256 + $1C
tsZLT equ otCMP*256 + $1D
tsZLE equ otCMP*256 + $1F
tsZGT equ otCMP*256 + $1E
tsDUP equ otDup*256 + 0
;tsQDUP equ otDup*256 + 1
;tsZDUP equ otDup*256 + 2
; Bit operations. The subtype code is the same as the type code
; in the corresponding 68000 instruction.
tsBtest equ otBit*256 + 0
tsBtoggle equ otBit*256 + 1
tsBreset equ otBit*256 + 2
tsBset equ otBit*256 + 3
; Length codes (in subtype byte) - used for fetch and @
Lcode equ 2
Wcode equ 1
Ccode equ 0
tsAt equ otAt*256 + Lcode
tsWat equ otAt*256 + Wcode
tsCat equ otAt*256 + Ccode
tsSt equ otStore*256 + Lcode
tsWst equ otStore*256 + Wcode
tsCst equ otStore*256 + Ccode
tsFetch equ otFetch * 256
tsCCok equ otCCok * 256